<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>迭代器</title>
</head>
<body>
    <script>
        //数组
        let arr = ['易烊千玺','王俊凯','王源'];

        //打印数据
        // console.log(arr);

        //遍历数组
        // for(let v of arr){
        //     console.log(v);
        // }

        //工作原理 调用的是 Symbol.iterator 方法
        let iterator = arr[Symbol.iterator]();

        console.log(iterator.next());
        console.log(iterator.next());
        console.log(iterator.next());
        console.log(iterator.next());
    </script>
</body>
</html> 